import request from '@/axios'
import { request5 } from '@/axios/request'
import { RoleListResponseData } from './type'

// export const getRoleListApi = () => {
//   return request.get({ url: '/mock/role/table' })
// }

export const getRoleListApi = () => {
  return request5.get<any, RoleListResponseData>('/getRoleList')
}

export const getRoleRouters = (role: string) => {
  return request5.get<any, IResponse<AppCustomRouteRecordRaw[]>>('/getRouter?role=' + role)
}

export const getLoginRole = (name: string, pwd: string) => {
  return request5.get<any, IResponse<string>>('/login?user=' + name + '&pwd=' + pwd)
}

export const updateRoleInfo = (name: string, routes: string,enabled:boolean) => {
  return request5.post<any, IResponse<string>>('/updateRoleRoutes', { name, routes ,enabled})
}
